#include <slothttpd/config/create_location.hpp>
#include <slothttpd/config/location/fcgi_location.hpp>
#include <slothttpd/config/location/file_location.hpp>

#include <boost/make_shared.hpp>

namespace slothttpd {
namespace config {

location_ptr create_location(const std::string &name,
                             const boost::property_tree::ptree &node,
                             server &s)
{
    if (name == "fcgi") {
        return boost::make_shared<fcgi_location>(node, s);
    } else if (name == "file_async") {
        return boost::make_shared<file_location>(node, s, true);
    } else if (name == "file") {
        return boost::make_shared<file_location>(node, s, false);
    }
    
    return location_ptr();
}

}
}
